/**
 * Copyright 2008, Simon Sadedin, Badboy Software.
 * 
 * $Id: AssertionImpl.java 16 2008-11-28 03:04:20Z ssadedin $
 *
 * This file is part of JBadboy.
 * 
 * JBadboy is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * JBadboy is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with JBadboy.  If not, see <http://www.gnu.org/licenses/>.
 */


package com.badboy.jbadboy.item;

import com.badboy.jbadboy.model.Assertion;

public class AssertionImpl extends Assertion {

    @Override
    public void play() throws ExecutionException {
        for(ScriptItem c : getSubItems()) {
            if(c instanceof Check) {
                Check check = (Check) c;
                CheckResult result = check.check(this);
                if(result.status != CheckExecutionStatus.SUCCEEDED) {
                    this.addChild(new AssertionFailureImpl(result.getDescription()));
                    break;
                }
            }
        }
    }
}
